﻿using _ViewBag测试.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace _ViewBag测试.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }


        public ActionResult ViewBagDome()
        {
            List<PersonInfo> personInfos = new List<PersonInfo>()
            {
                new PersonInfo(){ Id=1, Name="张三", Sex="男", Birthday=DateTime.Now.AddYears(-28), Hobby="下棋,看书" },
                new PersonInfo(){ Id=2, Name="李四", Sex="男", Birthday=DateTime.Now.AddYears(-26), Hobby="踢球,打篮球" },
                new PersonInfo(){ Id=3, Name="小兰", Sex="女", Birthday=DateTime.Now.AddYears(-20), Hobby="看书,跑步,下围棋" }
            };
            ViewBag.Persons = personInfos;
            return View();
        }



    }
}